package com.suke.czx.modules.tb.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.suke.czx.modules.tb.vo.CommentVO;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import com.suke.czx.modules.tb.mapper.TbCommentMapper;
import com.suke.czx.modules.tb.entity.TbComment;
import com.suke.czx.modules.tb.service.TbCommentService;

import java.util.Map;


/**
 * 评论表
 *
 * @author developer
 * @email developer@163.com
 * @date 2025-05-17 21:50:15
 */
@Service
public class TbCommentServiceImpl extends ServiceImpl<TbCommentMapper, TbComment> implements TbCommentService {

    @Override
    public IPage<CommentVO> commentPage(Map<String, Object> params) {
        String current = (String) params.get("current");
        String limit = (String) params.get("limit");
        int c = 0;
        int i = 0;
        if(StringUtils.isBlank(current) || StringUtils.isBlank(limit)){
            c = 1;
            i = 99;
        }else{
            c = Integer.parseInt(current);
            i = Integer.parseInt(limit);
        }
        IPage<CommentVO>  page = baseMapper.commentPage(new Page<>(c, i), params);
        return page;
    }
}
